package com.itheima.d2_byte_stream;

import java.io.*;

public class FileOutputStreamTest5 {
    public static void main(String[] args) throws IOException {

        File file = new File("day09file-io-app/file/aaa/bbb/img.png");
        File dest = new File("day09file-io-app/file22/ccc/img.png");
        try(  FileInputStream f1 = new FileInputStream(file);
              FileOutputStream f2 = new FileOutputStream(dest);){

            byte[] arr =new byte[1024];
            int leng ;
            while ((leng = f1.read(arr)) != -1) {//读取
                f2.write(arr,0,leng);//将读取在数组中的字节写出
            }
        } catch (IOException e) {
            e.printStackTrace();
        }



    }
}
